diff --git a/lib_blackfin/bf533_string.c b/lib_blackfin/bf533_string.c
index c8b1a3a..1d0aeb6 100644
--- a/lib_blackfin/bf533_string.c
+++ b/lib_blackfin/bf533_string.c
@@ -28,9 +28,14 @@
 #include <common.h>
 #include <asm/setup.h>
 #include <asm/page.h>
-#include <asm/cpu/defBF533.h>
+#include <config.h>
+#include <asm/blackfin.h>
 
-void *dma_memcpy(void *,const void *,size_t);
+extern void blackfin_icache_flush_range(const void *, const void *);
+extern void blackfin_dcache_flush_range(const void *, const void *);
+extern void *memcpy_ASM(void *dest, const void *src, size_t count);
+
+void *dma_memcpy(void *, const void *, size_t);
 
 char *strcpy(char *dest, const char *src)
 {
@@ -38,11 +43,11 @@
 	char temp = 0;
 
 	__asm__ __volatile__
-		("1:\t%2 = B [%1++] (Z);\n\t"
-		"B [%0++] = %2;\n\t"
-		"CC = %2;\n\t"
-		"if cc jump 1b (bp);\n":"=a"(dest), "=a"(src), "=d"(temp)
-		:"0"(dest), "1"(src), "2"(temp):"memory");
+	    ("1:\t%2 = B [%1++] (Z);\n\t"
+	     "B [%0++] = %2;\n\t"
+	     "CC = %2;\n\t"
+	     "if cc jump 1b (bp);\n":"=a"(dest), "=a"(src), "=d"(temp)
+	     :"0"(dest), "1"(src), "2"(temp):"memory");
 
 	return xdest;
 }
@@ -56,16 +61,16 @@
 		return xdest;
 
 	__asm__ __volatile__
-		("1:\t%3 = B [%1++] (Z);\n\t"
-		"B [%0++] = %3;\n\t"
-		"CC = %3;\n\t"
-		"if ! cc jump 2f;\n\t"
-		"%2 += -1;\n\t"
-		"CC = %2 == 0;\n\t"
-		"if ! cc jump 1b (bp);\n"
-		"2:\n":"=a"(dest), "=a"(src), "=da"(n), "=d"(temp)
-		:"0"(dest), "1"(src), "2"(n), "3"(temp)
-		:"memory");
+	    ("1:\t%3 = B [%1++] (Z);\n\t"
+	     "B [%0++] = %3;\n\t"
+	     "CC = %3;\n\t"
+	     "if ! cc jump 2f;\n\t"
+	     "%2 += -1;\n\t"
+	     "CC = %2 == 0;\n\t"
+	     "if ! cc jump 1b (bp);\n"
+	     "2:\n":"=a"(dest), "=a"(src), "=da"(n), "=d"(temp)
+	     :"0"(dest), "1"(src), "2"(n), "3"(temp)
+	     :"memory");
 
 	return xdest;
 }
@@ -74,18 +79,16 @@
 {
 	char __res1, __res2;
 
-	__asm__
-		("1:\t%2 = B[%0++] (Z);\n\t"	/* get *cs */
-		"%3 = B[%1++] (Z);\n\t"		/* get *ct */
-		"CC = %2 == %3;\n\t"		/* compare a byte */
-		"if ! cc jump 2f;\n\t"		/* not equal, break out */
-		"CC = %2;\n\t"			/* at end of cs? */
+	__asm__("1:\t%2 = B[%0++] (Z);\n\t"	/* get *cs */
+		"%3 = B[%1++] (Z);\n\t"	/* get *ct */
+		"CC = %2 == %3;\n\t"	/* compare a byte */
+		"if ! cc jump 2f;\n\t"	/* not equal, break out */
+		"CC = %2;\n\t"	/* at end of cs? */
 		"if cc jump 1b (bp);\n\t"	/* no, keep going */
-		"jump.s 3f;\n"			/* strings are equal */
-		"2:\t%2 = %2 - %3;\n"		/* *cs - *ct */
-		"3:\n":	"=a"(cs), "=a"(ct), "=d"(__res1),
-		"=d"(__res2)
-		: "0"(cs), "1"(ct));
+		"jump.s 3f;\n"	/* strings are equal */
+		"2:\t%2 = %2 - %3;\n"	/* *cs - *ct */
+      "3:\n":	"=a"(cs), "=a"(ct), "=d"(__res1), "=d"(__res2)
+      :	"0"(cs), "1"(ct));
 
 	return __res1;
 }
@@ -97,20 +100,19 @@
 	if (!count)
 		return 0;
 
-	__asm__
-		("1:\t%3 = B[%0++] (Z);\n\t"	/* get *cs */
-		"%4 = B[%1++] (Z);\n\t"		/* get *ct */
-		"CC = %3 == %4;\n\t"		/* compare a byte */
-		"if ! cc jump 3f;\n\t"		/* not equal, break out */
-		"CC = %3;\n\t"			/* at end of cs? */
-		"if ! cc jump 4f;\n\t"		/* yes, all done */
-		"%2 += -1;\n\t"			/* no, adjust count */
+	__asm__("1:\t%3 = B[%0++] (Z);\n\t"	/* get *cs */
+		"%4 = B[%1++] (Z);\n\t"	/* get *ct */
+		"CC = %3 == %4;\n\t"	/* compare a byte */
+		"if ! cc jump 3f;\n\t"	/* not equal, break out */
+		"CC = %3;\n\t"	/* at end of cs? */
+		"if ! cc jump 4f;\n\t"	/* yes, all done */
+		"%2 += -1;\n\t"	/* no, adjust count */
 		"CC = %2 == 0;\n\t" "if ! cc jump 1b;\n"	/* more to do, keep going */
-		"2:\t%3 = 0;\n\t"		/* strings are equal */
+		"2:\t%3 = 0;\n\t"	/* strings are equal */
 		"jump.s    4f;\n" "3:\t%3 = %3 - %4;\n"	/* *cs - *ct */
- 		"4:":	"=a"(cs), "=a"(ct), "=da"(count), "=d"(__res1),
+      "4:":	"=a"(cs), "=a"(ct), "=da"(count), "=d"(__res1),
 		"=d"(__res2)
-		: "0"(cs), "1"(ct), "2"(count));
+      :	"0"(cs), "1"(ct), "2"(count));
 
 	return __res1;
 }
@@ -124,62 +126,65 @@
  * You should not use this function to access IO space, use memcpy_toio()
  * or memcpy_fromio() instead.
  */
-void * memcpy(void * dest,const void *src,size_t count)
+void *memcpy(void *dest, const void *src, size_t count)
 {
-	char *tmp = (char *) dest, *s = (char *) src;
+	char *tmp = (char *)dest, *s = (char *)src;
 
-/* Turn off the cache, if destination in the L1 memory */
-	if ( (tmp >= (char *)L1_ISRAM) && (tmp < (char *)L1_ISRAM_END)
-		|| (tmp >= (char *)DATA_BANKA_SRAM) && (tmp < DATA_BANKA_SRAM_END)
-	    || (tmp >= (char *)DATA_BANKB_SRAM) && (tmp < DATA_BANKB_SRAM_END) ){
-			if(icache_status()){
-					blackfin_icache_flush_range(src, src+count);
-					icache_disable();
-			}
-			if(dcache_status()){
-					blackfin_dcache_flush_range(src, src+count);
-					dcache_disable();
-			}
-			dma_memcpy(dest,src,count);
-	}else{
-		while(count--)
-			*tmp++ = *s++;
+	/* L1_ISRAM can only be accessed via dma */
+	if ((tmp >= (char *)L1_ISRAM) && (tmp < (char *)L1_ISRAM_END)) {
+		/* L1 is the destination */
+		dma_memcpy(dest, src, count);
+
+		if (icache_status()) {
+			blackfin_icache_flush_range(src, src + count);
+		}
+	} else if ((s >= (char *)L1_ISRAM) && (s < (char *)L1_ISRAM_END)) {
+		/* L1 is the source */
+		dma_memcpy(dest, src, count);
+
+		if (icache_status()) {
+			blackfin_icache_flush_range(dest, dest + count);
+		}
+		if (dcache_status()) {
+			blackfin_dcache_flush_range(dest, dest + count);
+		}
+	} else {
+		memcpy_ASM(dest, src, count);
 	}
 	return dest;
 }
 
-void *dma_memcpy(void * dest,const void *src,size_t count)
+void *dma_memcpy(void *dest, const void *src, size_t count)
 {
+	*pMDMA_D0_IRQ_STATUS = DMA_DONE | DMA_ERR;
 
-		*pMDMA_D0_IRQ_STATUS = DMA_DONE | DMA_ERR;
+	/* Copy sram functions from sdram to sram */
+	/* Setup destination start address */
+	*pMDMA_D0_START_ADDR = (volatile void **)dest;
+	/* Setup destination xcount */
+	*pMDMA_D0_X_COUNT = count;
+	/* Setup destination xmodify */
+	*pMDMA_D0_X_MODIFY = 1;
 
-		/* Copy sram functions from sdram to sram */
-		/* Setup destination start address */
-		*pMDMA_D0_START_ADDR = (volatile void **)dest;
-		/* Setup destination xcount */
-		*pMDMA_D0_X_COUNT = count ;
-		/* Setup destination xmodify */
-		*pMDMA_D0_X_MODIFY = 1;
+	/* Setup Source start address */
+	*pMDMA_S0_START_ADDR = (volatile void **)src;
+	/* Setup Source xcount */
+	*pMDMA_S0_X_COUNT = count;
+	/* Setup Source xmodify */
+	*pMDMA_S0_X_MODIFY = 1;
 
-		/* Setup Source start address */
-		*pMDMA_S0_START_ADDR = (volatile void **)src;
-		/* Setup Source xcount */
-		*pMDMA_S0_X_COUNT = count;
-		/* Setup Source xmodify */
-		*pMDMA_S0_X_MODIFY = 1;
+	/* Enable source DMA */
+	*pMDMA_S0_CONFIG = (DMAEN);
+	__builtin_bfin_ssync();
 
-		/* Enable source DMA */
-		*pMDMA_S0_CONFIG = (DMAEN);
-		asm("ssync;");
+	*pMDMA_D0_CONFIG = (WNR | DMAEN);
 
-		*pMDMA_D0_CONFIG = ( WNR | DMAEN);
-
-		while(*pMDMA_D0_IRQ_STATUS & DMA_RUN){
-			*pMDMA_D0_IRQ_STATUS |= (DMA_DONE | DMA_ERR);
-		}
+	while (*pMDMA_D0_IRQ_STATUS & DMA_RUN) {
 		*pMDMA_D0_IRQ_STATUS |= (DMA_DONE | DMA_ERR);
+	}
+	*pMDMA_D0_IRQ_STATUS |= (DMA_DONE | DMA_ERR);
 
-		dest += count;
-		src  += count;
-		return dest;
+	dest += count;
+	src += count;
+	return dest;
 }
